import { defineStore } from 'pinia';

export const gateWayAttr =  defineStore('gateWayAttr',{
    state:()=>({
        gateWays:[]
    }),
    actions:{
        setStateData(value){
            this.gateWays=value;
        },
        addWateWay(gateWay){
            this.gateWays.push(gateWay);
        },
        updateGateWayByNo(NO,updatedProperties){
            const index = this.gateWays.findIndex(item => item.GATEWAY_NO === NO); 
            if (index !== -1) {  
                Object.assign(this.gateWays[index], updatedProperties);  
            }
        },
    }
});